// JavaScript Document

$(document).ready(function(e) {

    // GRID IT

    var $tumblelog = $('.gridIt');
    $tumblelog.imagesLoaded(function() {
        $tumblelog.masonry({
            columnWidth : 214,
            isAnimated : true,
            gutterWidth : 20
        });
    });
    $(document).ready(function() {
        });
    // DOM FIX - MAIN CONTAINER FIX
    var mainColW = $('#main').width();
    var sideBarW = $('#sidebar-left').width();
    var mainCol = $('#main');
    var sideBar = $('#sidebar-left');
    var sideBarMargin = sideBar.css('margin');
    var windowW = $(window).width();

    $('#main').css('width', ($(window).width() - ($('#sidebar-left').width() + 120)) + 'px');
    $(window).resize(function() {
        $('#main').css('width', ($(window).width() - ($('#sidebar-left').width() + 120)) + 'px');
    });

    $('#menu-row li:first').css('margin-left', 0);

// End of documentum Ready Func.

});
// TO TOP BTN - Declaration

$(document).ready(function() {

    $().UItoTop({
        easingType : 'easeOutQuart'
    });

});
// RUMBLR PLUGIN - Declaration

$(document).ready(function() {
    $('.rumble-it').jrumble({
        rangeX : 2,
        rangeY : 2,
        rangeRot : 1
    });
});
// JTWEET Anywhere Plugin - Declaration

$(document).ready(function() {
    $('#mhTweetFeed').jTweetsAnywhere({
        searchParams : ['q=magyarhangya', 'lang=hu'],
        count : 5,
        tweetTimestampDecorator : function(tweet, options) {
            var screenName = tweet.user ? tweet.user.screen_name : false || tweet.from_user;
            var date = new Date(formatDate(tweet.created_at));

            var dateString = date.getHours() + ':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes() + ' ' + (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();

            var html = '<span class="jta-tweet-timestamp"> "' + '<a class="jta-tweet-timestamp-link" href="http://twitter.com/' + screenName + '/status/' + tweet.id + '">' + dateString + '</a></span>';

            return html;
        }
    });
});
// Animate link color

$(document).ready(function() {
    $('.box p a').hover(function() {
        $(this).stop(true).animate({
            color : "#333333"
        }, {
            duration : 500,
            queue : false
        });

    }, function() {

        $(this).stop(true).animate({
            color : "#F77825"
        }, {
            duration : 500,
            queue : false
        });
    });
});

$(document).ready(function() {

    $('.mainFilms .box').hover(function() {
        $('a', this).animate({
            color : "#555555"
        }, 500);

    }, function() {

        $('a', this).animate({
            color : "#000000"
        }, 500);

    });
});
// effect fd-cast-month
$(document).ready(function() {
    $('.fd-box-content ul li').hover(function() {
        $(this).animate({
            paddingLeft : '5px',
            backgroundColor : 'rgba(0,0,0,0.04)'
        }, {
            queue : false,
            duration : 200
        });

    }, function() {

        $(this).animate({
            paddingLeft : '0px',
            backgroundColor : 'rgba(0,0,0,0)'
        }, {
            queue : false,
            duration : 200
        });
    });
    // Arrow nextpage (index)

    $('#next-page img').hover(function() {
        $(this).stop(true).animate({
            top : '10px'
        }, {
            queue : false
        });
    }, function() {
        $(this).stop(true).animate({
            top : '0px'
        }, {
            queue : false
        });

    });
    // Searchbar

    $('#search-toggle-btn').click(function() {
        $('#search-it').slideToggle('slow', 'easeOutBounce');

    });
    // Vido Z-index fix

    $('iframe').each(function() {
        var url = $(this).attr("src");
        $(this).attr("src", url + "?wmode=transparent&rel=0");
    });
    //* transify
    $('#search-it').css({
        backgroundColor : 'rgba(0,0,0,0.4)'
    });

    // Btn animation

    $('#search-toggle-btn').hover(function() {

        $(this).stop(true).animate({
            marginTop : '-36px'
        }, {
            queue : false
        });

    }, function() {
        $(this).stop(true).animate({
            marginTop : '-46px'
        }, {
            queue : false
        });

    });

    
});
// GridSystem Plugin - Declaration